<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>	
<%@ include file="/pub/headmeta.jsp" %>
</head>
<body class="edit-bgr-color">
	<div class="right-head"><span class="right-head-font">个人资料维护</span></div>
	<div align="center" style="width: 98%">	
		<form id="editForm" method="post">
			<table cellpadding="5" style="width: 600px; font-size: 12px;">			
				<tr>
					<td align="right">昵称：</td>
					<td align="left"><input type="text" name="name" id="name" style="width: 60%" value="${user.name}"/></td>					
				</tr>
				<tr>
					<td align="right">性别：</td>
					<td align="left"><input type="radio" name="sex" value="1" checked="checked"/>男&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="sex" value="2"/>女</td>					
				</tr>
				<tr>
					<td align="right">生日：</td>
					<td align="left"><input type="text" name="birthday" id="birthday" class="Wdate" onClick="WdatePicker()"/></td>					
				</tr>
				<tr>
					<td align="right">手机号码：</td>
					<td align="left"><input type="text" name="phone" id="phone" style="width: 60%" value="${user.phone}"/></td>					
				</tr>
				<tr>
					<td align="right">电子邮件：</td>
					<td align="left"><input type="text" name="email" id="email" style="width: 60%"  value="${user.email}"/></td>					
				</tr>
				<tr>
					<td align="right">身份证号：</td>
					<td><input type="text" name="idcard" id="idcard" style="width: 60%"  value="${user.idcard}"/></td>					
				</tr>
			</table>
			<div class="edit-line"></div>
			<input  type="button" class="button-1" value="修改" onclick="doEdit();"/>
			<input  type="button" class="button-1" value="重置" onclick="resetEx(this.form);loadData();"/>						
		</form>
	</div>
</body>
</html>
<script type="text/javascript">
<!--
//自动调用初始化
$(document).ready(function(){	
	loadData();
});

//初始化
function loadData(){	
	$("input[type='radio'][name='sex'][value='${user.sex}']").attr("checked",true);		
	$('#birthday').val('${user.birthday}'.substring(0,10));	
}

//修改
function doEdit() {	
	var url="${ctx}/user!personEdit.action";
	$.post(url, $("#editForm").serialize() ,function callback(txt){   
			var json = $.parseJSON(txt);
			if (json.code==0) {	
				alert('修改成功！');				
			}else{
				alert('修改失败！');
			}
		}	
	);
}
//-->
</script>
